using KrasDD.Models;
using KrasDD.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;

namespace KrasDD.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class IdentityController : BaseController<IDENTITY>
    {
        private readonly IIdentityService _identityService;

        public IdentityController(IBaseService<IDENTITY> service, IIdentityService identityService) : base(service)
        {
            _identityService = identityService;
        }

        [HttpGet("{id}/is-current")]
        public async Task<bool> CheckIsCurrent(string id)
        {
            return await _identityService.CheckIsCurrentAsync(id);
        }

        [HttpGet("{id}/accesses")]
        public async Task<List<ACCESS>> GetAccesses(string id)
        {
            return await _identityService.GetAccessesAsync(id);
        }
    }
}
